home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-06 | 2.4 KB | 125 lines | [TEXT/MSET] |
- \ 28Oct94 dbh updated to 2.5 syntax
-
- (*
-
- A tescrollVH is a tescrollV with a vertical scrollbar and
- a horizontal scrollbar.
-
- *)
-
-
- :class texthScroll super{ hscrollBar }
-
- \ ScrollOnce: is a late-bound call in the superclass, so this is all we need
-
- :m ScrollOnce:
- get: controlWas get: self - get: pixDelta * ( dh)
- 0 ( dv)
- pack
- handle: [ get: scrollObject ] \ will be the TEHandle, of course
- call TEPinScroll
- get: self put: controlWas
- ;m
-
- ;class
-
- :class tescrollVH super{ tescrollV }
- texthScroll thscroll
-
- :m CalcHScrollValue: ( -- n )
- ptr: super 8 + ( view) gettopx: rect
- ptr: super ( dest) gettopx: rect -
- ;m
-
- :m >dest: { dx -- } \ stretch dest rect to the right by dx pixels
- dest: super ( l t r b )
- swap dx + swap
- setdest: super ;m
-
- \ (new): must only be called at new: time since we store an address to self
- \ in a scrollbar, and self may well be an ivar !!
- :m (new):
- view: super { l t r b -- }
- l 1- ( x ) b ( y ) r l - 2+ ( len ) init: thscroll
-
- 12 40 setscrollValues: thscroll \ should do something more intelligent here?
- 0 90 putrange: thscroll
- ;m
-
-
- :m new: { wptr -- }
- wptr new: super
- (new): self
- wptr new: thscroll
- self scrolledBy: thscroll
- 550 >dest: self \ set the dest rect width to 550 pixels
- noWrap: super \ we don't want wordwrap here. Also, it's faster.
- ;m
-
- :m activate:
- activate: super
- activate: thscroll ;m
-
- :m deactivate:
- deactivate: super
- deactivate: thscroll ;m
-
- :m release:
- release: super
- release: thscroll ;m
-
- :m setControl: \ actually, we are setting 2 controls
- \ we keep the setControl: name because this will be called late bound
- \ from the superclass after a variety of methods.
- setControl: super
- view: super ( l t r b ) drop nip ( l r ) - abs ( viewwidth )
- dest: super ( l t r b ) drop nip ( l r ) - abs ( destwidth ) swap - 0 max
- 0 swap putrange: thscroll
- CalcHScrollValue: self set: thscroll
- draw: thscroll
- ;m
-
- :m hit?: ( -- b )
- view: super put: temprect 16 16 stretch: temprect
- where: theMouse
- temprect PtinRect
- ;m
-
- :m click:
- hit?: thscroll
- IF click: thscroll
- setControl: [self] exit
- THEN
- click: super ;m
-
- :m draw:
- draw: super
- draw: thscroll
- ;m
-
- :m move: { dx dy -- }
- dx dy move: super
- dx dy move: thscroll ;m
-
- :m moveto: { x y -- }
- x y moveto: super
- x y moveto: thscroll ;m
-
- ;class
-
- endload
-
- *** EXAMPLE USE
-
- selwindow w
- test: w
-
- tescrollVH tvh
- tvh add: w
-
- tescrollVH tvh2
- 0 100 move: tvh2
- tvh2 add: w
-
-
-